//
//  FoodModel.m
//  LoveBeeProject
//
//  Created by dix on 2017/1/5.
//  Copyright © 2017年 斯芬克斯. All rights reserved.
//

#import "FoodModel.h"
#import <YYModel.h>
#import "NetworkTool.h"
@implementation FoodModel
+ (void)loadNewsDataWithUrlStr:(NSString *)urlStr parameters:(id)parameters complete:(void(^)(NSDictionary *dataDict))completeBlock success:(void(^)(NSArray *newsList))successBlock failed:(void(^)(NSError *error))failedBlock{
    
    [[NetworkTool sharedTool] POSTWith:urlStr parameters:parameters success:^(id responseObject) {
        //接受responseObject
        
        id result = [NSJSONSerialization JSONObjectWithData:responseObject options:0 error:nil];
        NSDictionary *dataDict = result[@"data"];
        NSArray *dictArr = dataDict[@"categories"];
        NSArray *newsList = [NSArray yy_modelArrayWithClass:[FoodModel class] json:dictArr];
        if (completeBlock) {
            completeBlock(dataDict);
        }
        if (successBlock) {
            successBlock(newsList);
        }
        
    } failed:^(NSError *error) {
        
    }];
    
    
}

@end
